package com.devbobcorn.nekorization.client.rendering;

import com.devbobcorn.nekorization.Nekorization;
import com.devbobcorn.nekorization.client.model.NekoModel;
import com.devbobcorn.nekorization.entities.NekoEntity;

import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.HumanoidMobRenderer;
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class NekoRenderer extends HumanoidMobRenderer<NekoEntity, NekoModel<NekoEntity>> {
	private static final ResourceLocation SKIN = new ResourceLocation(Nekorization.MODID, "textures/entity/neko/skin.png");

	public NekoRenderer(EntityRendererProvider.Context ctx, boolean slim) {
		super(ctx, getModel(ctx, slim), 0.4F);
		this.addLayer(new NekoInnerLayer(this, getModel(ctx, slim)));
		this.addLayer(new NekoOuterLayer(this, getModel(ctx, slim)));
		this.addLayer(new NekoSpriteOnHeadLayer<>(this, ctx.getModelSet()));
		this.addLayer(new HumanoidArmorLayer<>(this, getModel(ctx, slim), getModel(ctx, slim)));
	}

	public ResourceLocation getTextureLocation(NekoEntity entity) {
		return SKIN;
	}

	private static NekoModel<NekoEntity> getModel(EntityRendererProvider.Context ctx, boolean slim) {
		return new NekoModel<>(ctx, slim);
	}
}